from django.urls import path, re_path
from django.conf.urls import url, include
from rest_framework import routers
from book.views import BookSnippetList, CodeSnippetList, Ref_url,Kuaishou_url

router = routers.DefaultRouter()

urlpatterns = [
    path('', include(router.urls)),
    re_path(r"^users/$", BookSnippetList.as_view({
        "get": "list",
        "post": "create"
    })),
    re_path(r"^maoyan/$", CodeSnippetList.as_view({
        "get": "list",
        "post": "create"
    })),
re_path(r"^kuaishou/$", CodeSnippetList.as_view({
        "get": "list",
        "post": "create"
    })),
    re_path(r"^users/(?P<name>\w+)/$", BookSnippetList.as_view({
        "get": "retrieve",
        "put": "update",
        "delete": "destroy"
    })),
    re_path(r"^maoyan/(?P<id>\w+)/$", CodeSnippetList.as_view({
        "get": "retrieve",
        "put": "update",
        "delete": "destroy"
    })),
re_path(r"^kuaishou/(?P<id>\w+)/$", CodeSnippetList.as_view({
        "get": "retrieve",
        "put": "update",
        "delete": "destroy"
    })),

    re_path(r"^ref_url/(?P<id>\w+)/$", Ref_url),
    re_path(r"^kuaishou_url/(?P<id>\w+)/$", Kuaishou_url),

]
